package org.apache.flink.runtime.resourceprovider.slot;

import java.io.IOException;
import java.util.Collection;

/** Service for persisting {@link SlotAllocationSnapshot}. */
public interface SlotAllocationSnapshotPersistenceService {

    /**
     * Persist the given slot allocation snapshot.
     *
     * @param slotAllocationSnapshot slot allocation snapshot to persist
     * @throws IOException if the slot allocation snapshot cannot be persisted
     */
    void persistAllocationSnapshot(SlotAllocationSnapshot slotAllocationSnapshot)
            throws IOException;

    /**
     * Delete the slot allocation snapshot identified by the slot index.
     *
     * @param slotIndex identifying the slot allocation snapshot to delete
     */
    void deleteAllocationSnapshot(int slotIndex);

    /**
     * Load all persisted slot allocation snapshots.
     *
     * @return loaded slot allocations snapshots
     */
    Collection<SlotAllocationSnapshot> loadAllocationSnapshots();
}
